package com.example.luozizhao.eprxdemo.commom;
import android.app.Application;
import android.content.Context;
import android.support.multidex.MultiDex;
import com.blankj.utilcode.util.Utils;
import com.example.luozizhao.eprxdemo.di.component.AppComponent;
import com.example.luozizhao.eprxdemo.di.component.DaggerAppComponent;
import com.example.luozizhao.eprxdemo.di.module.AppModle;
import org.xutils.x;

/**
 * Created by luozizhao on 2018/4/24.
 */

public class App extends Application {

    public static Context applicationContext;
    public static App instance;
    private static volatile AppComponent sAppComponent;

    @Override
    public void onCreate() {
        super.onCreate();
        MultiDex.install(this);
        Utils.init(this);
        instance = this;
        // 初始化xutils
        x.Ext.init(this);
        x.Ext.setDebug(BuildConfig.DEBUG); // 是否输出debug日志
        applicationContext = this;
    }


    public static synchronized AppComponent getAppComponent(){
        if (sAppComponent==null) {
            sAppComponent = DaggerAppComponent.builder().appModle(new AppModle(instance)).build();
        }
        return sAppComponent;
    }

}
